<?php

require_once(CMS_PATH.'views'.DS.'helpers'.DS.'index.php');

class GridIndexHelper extends IndexHelper 
{
	var $limitCheckbox = false;
	
	function _buildHeader($options)
	{
		$this->output .= $this->Html->css('/cms/css/grid.css') . '<div class="grid">';
	}
	
	function _buildRows($records, $options)
	{
		$output = null;
		foreach($records as $record)
		{
			$output .= '<div class="record_wrapper">';
			if(!empty($this->buttons))
			{
				$output .= '<input value="'.$record[$this->model()]['id'].'" class="rowSelectors" type="checkbox" onchange=\'$(this).parent().parent().toggleClass("selected");\'>'; // @todo finish checkbox / row selector
			}
			$output .= '<div class="record">';
			
			$tmpRecord = Utility::dotNotation($record);
			$row = String::insert($this->rowTemplate, $tmpRecord);
			$output .= $row;
			
			$output .= '</div></div>';
		}
		$this->output .= $output;
	}
	function _buildFooter($options)
	{
		$this->output .= '</div>';
	}
	
	function setRowTemplate($template)
	{
		$this->rowTemplate = $template;
	}
	
}
?>